//
//  RegisterViewController.swift
//  NeusoftSchool
//
//  Created by 李狗蛋 on 2017/3/22.
//  Copyright © 2017年 李狗蛋. All rights reserved.
//

import UIKit

class RegisterViewController: UIViewController {

    @IBOutlet weak var userName: UITextField!
    
    @IBOutlet weak var passWord: UITextField!
    
  
    @IBOutlet weak var mobileNum: UITextField!
    
    @IBOutlet weak var address: UITextField!
    
    @IBOutlet weak var comment: UITextField!
    @IBAction func register(_ sender: UIButton) {
        
        if userName.text == "" {
            //print("用户名没有输入")
            MBProgressHUD.showDelayHUDToView(self.view, message: "用户名没有输入")
        }else{
            if passWord.text == "" {
                //print("密码没有输入")
                MBProgressHUD.showDelayHUDToView(self.view, message: "密码没有输入")
            }else{
                //验证用户名密码
                let parameters: NSDictionary = ["username": userName.text!,"userpass": passWord.text!,"mobilenum": mobileNum.text!,"address": address.text!,"comment": comment.text!]
                RONetworkMngTool.sharedNetwodkMngTool().RONetwork_Register(parameters, view: self.view, block: { (flag) in
                    if flag == "1" {
                        //let _ = (ACSimpleKeychain)
                        print("注册成功，跳转到主页")
                    }else{
                        print("注册失败")
                    }
                })
            }
        }
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
